home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / gui / muibuilderv11.lha / muibuilder / mb / asm / SpecialChars.asm < prev    next >
Assembly Source File  |  1994-03-15  |  6KB  |  251 lines

  1.     include    ssmac.h        ;Include macros and offsets
  2.     include    libraries/mui_alt.i
  3.     include    libraries/mui_asm.i
  4.     include    libraries/mui_lib.i
  5.  
  6. GENERATE_DECLS    equ    1
  7. GENERATE_ENV    equ    1
  8. GENERATE_CODE    equ    1
  9. GENERATE_LOCALE    equ    0
  10.  
  11. CALLINT    macro
  12.     call    intuition,\1    ;My macros doesn't have this macro
  13.     endm
  14.  
  15. CALLEXEC    macro
  16.     call    exec,\1
  17.     endm
  18.  
  19.     start    ;Start initialization
  20.  
  21.     get.l    muimasterbase,MUIMASTER_BASE
  22.  
  23.     IFNE    GENERATE_LOCALE   ; Generate following code only when user wants it.
  24.     sub.l    a0,a0
  25.     lea    catalog_name(pc),a1
  26.     sub.l    a2,a2
  27.     CALLLOCALE    OpenCatalogA
  28.     lea    catalog(pc),a0
  29.     move.l    d0,(a0)
  30.     beq    no_catalog   ;This part of program have to print error message and jump to label 'cleanup'.
  31.     ENDC    ;GENERATE_LOCALE
  32.  
  33.     bsr    InitGUI
  34.     errc.ne    <Cannot create GUI>    ;Macro for conditional error
  35.  
  36.     DoMethod    WI_SpecialChars,#MUIM_Notify,#MUIA_Window_CloseRequest,#TRUE,App,#2,#MUIM_Application_ReturnID,#MUIV_Application_ReturnID_Quit
  37.  
  38.     seti    WI_SpecialChars,#MUIA_Window_Open,#TRUE    ;Open window
  39.  
  40.     IFNE    GENERATE_ENV
  41. main_loop    DoMethod    App,#MUIM_Application_Input,#signal
  42.     tst.l    d0
  43.     bne.s    1$
  44.     move.l    signal(pc),d0
  45.     CALLEXEC    Wait
  46.     bra.s    main_loop
  47. 1$
  48.     cmp.l    #MUIV_Application_ReturnID_Quit,d0
  49.     bne.s    main_loop
  50.  
  51. cleanup
  52.     IFNE    GENERATE_LOCALE
  53.     move.l    catalog(pc),d0
  54.     beq.s    1$
  55.     move.l    d0,a0
  56.     CALLLOCALE    CloseCatalog
  57.     ENDC    ;GENERATE_LOCALE
  58.  
  59. 1$    move.l    App(pc),d0
  60.     beq.s    2$
  61.     move.l    d0,a0
  62.     CALLMUI    MUI_DisposeObject
  63. 2$    bra.s    user_cleanup
  64. signal    dc.l    0
  65. user_cleanup
  66.     ENDC    ;GENERATE_ENV
  67.     ;Here is place for the cleanup routine.
  68.  
  69.     rts
  70.  
  71.     IFNE    GENERATE_LOCALE
  72. GetString    move.l    catalog(pc),a0
  73.     sub.l    a1,a1
  74.     CALLLOCALE    GetCatalogStr
  75.     rts
  76.  
  77. catalog    dc.l    0
  78.     even
  79.     ENDC    ;GENERATE_LOCALE
  80.  
  81.     IFNE    GENERATE_DECLS
  82. InitGUI    movem.l    a2/d2/d7,-(a7)
  83.     move.l    a7,d7
  84.     lea    object_tags(pc),a2
  85. 1$    tst.l    (a2)
  86.     beq.s    2$
  87.  
  88.     move.l    #$8FFFFFFF,d0
  89.     move.l    d0,d2
  90.     subq.l    #1,d2
  91.     lea    8(a2),a0
  92.     moveq    #0,d1
  93. 3$    tst.l    (a0)
  94.     beq.s    4$
  95.     cmp.l    (a0),d2
  96.     beq.s    14$
  97.     cmp.l    (a0),d0
  98.     bne.s    5$
  99.     addq.l    #4,d1
  100. 5$    addq.l    #8,a0
  101.     bra.s    3$
  102.  
  103. 14$
  104.     IFNE    GENERATE_LOCALE
  105.     movem.l    d0-1,-(a7)
  106.     lea    loc_tag_vals(pc),a1
  107.     move.l    4(a0),d0
  108.     move.l    d0,-(a7)
  109.     lsl.l    #2,d0
  110.     move.l    -4(a1,d0.l),(a0)+
  111.     move.l    (a7)+,d0
  112.     move.l    a0,-(a7)
  113.     bsr    GetString
  114.     move.l    (a7)+,a0
  115.     move.l    d0,a1
  116.     move.l    d0,(a0)+
  117.     cmp.l    #MUIA_Text_HiChar,(a0)
  118.     bne.s    15$
  119.     cmp.l    #MUIA_Text_Contents,-8(a0)
  120.     bne.s    15$
  121.     cmp.b    #'_',(a1)
  122.     bne.s    15$
  123.     moveq    #0,d0
  124.     move.b    2(a1),d0
  125.     move.l    d0,4(a0)
  126.     move.l    d0,12(a0)
  127.     addq.l    #2,a1
  128.     move.l    d0,-4(a0)
  129. 15$    movem.l    (a7)+,d0-1
  130.     ENDC    GENERATE_LOCALE
  131.     bra.s    3$
  132.  
  133. 4$    tst.l    d1
  134.     beq.s    10$
  135.     lea    8(a2),a0
  136.     lea    (a7,d1.l),a1
  137.     move.l    a1,-(a7)
  138. 7$    tst.l    (a0)
  139.     beq.s    8$
  140.     cmp.l    (a0),d0
  141.     bne.s    9$
  142.     move.l    4(a0),(a0)+
  143.     move.l    -(a1),(a0)+
  144.     bra.s    7$
  145. 9$    addq.l    #8,a0
  146.     bra.s    7$
  147.  
  148. 8$    move.l    (a7),a7
  149.  
  150. 10$    move.l    a0,-(a7)
  151.     move.l    (a2),a0
  152.     move.l    (a0),a0
  153.     lea    8(a2),a1
  154.     CALLMUI    MUI_NewObjectA
  155.     move.l    4(a2),a0
  156.     move.l    a0,d1
  157.     beq.s    11$
  158.     move.l    d0,(a0)
  159. 11$    move.l    (a7)+,a2
  160.     tst.l    d0
  161.     beq.s    12$
  162.     move.l    d0,-(a7)
  163.     addq.l    #4,a2
  164.     bra.s    1$
  165.  
  166. 2$    move.l    d7,a7
  167. 13$    movem.l    (a7)+,a2/d2/d7
  168.     tst.l    d0
  169.     rts
  170.  
  171. 12$    moveq    #0,d0
  172.     cmp.l    d7,a7
  173.     beq.s    13$
  174.     move.l    (a7)+,a0
  175.     CALLMUI    MUI_DisposeObject
  176.     bra.s    12$
  177.  
  178. _DoMethod    move.l    a2,-(a7)
  179.     move.l    8(a7),a2
  180.     move.l    a2,d0
  181.     beq.s    1$
  182.     lea    12(a7),a1
  183.     move.l    -4(a2),a0
  184.     move.l    8(a0),a6
  185.     jsr    (a6)
  186.     move.l    (a7)+,a2
  187.     rts
  188.  
  189. 1$    moveq    #0,d0
  190.     move.l    (a7)+,a2
  191.     rts
  192.  
  193. object_tags    dc.l    MUIC_Text,BT_label_0,MUIA_Frame,MUIV_Frame_Button,MUIA_Text_Contents,str9,MUIA_Text_PreParse,PreParse,MUIA_Text_SetMax,FALSE
  194.     dc.l    MUIA_ControlChar,'b',MUIA_Text_HiChar,'b',MUIA_InputMode,MUIV_InputModeRelVerify,MUIA_Background,MUII_ButtonBack,0
  195.  
  196.     dc.l    MUIC_Text,BT_label_1,MUIA_Frame,MUIV_Frame_Button,MUIA_Text_Contents,str10,MUIA_Text_PreParse,PreParse,MUIA_Text_SetMax,FALSE
  197.     dc.l    MUIA_ControlChar,'b',MUIA_Text_HiChar,'b',MUIA_InputMode,MUIV_InputModeRelVerify,MUIA_Background,MUII_ButtonBack,0
  198.  
  199.     dc.l    MUIC_Text,BT_label_2,MUIA_Frame,MUIV_Frame_Button,MUIA_Text_Contents,str11,MUIA_Text_PreParse,PreParse,MUIA_Text_SetMax,FALSE
  200.     dc.l    MUIA_ControlChar,'b',MUIA_Text_HiChar,'b',MUIA_InputMode,MUIV_InputModeRelVerify,MUIA_Background,MUII_ButtonBack,0
  201.  
  202.     dc.l    MUIC_Text,BT_label_3,MUIA_Frame,MUIV_Frame_Button,MUIA_Text_Contents,str12,MUIA_Text_PreParse,PreParse,MUIA_Text_SetMax,FALSE
  203.     dc.l    MUIA_ControlChar,'b',MUIA_Text_HiChar,'b',MUIA_InputMode,MUIV_InputModeRelVerify,MUIA_Background,MUII_ButtonBack,0
  204.  
  205.     dc.l    MUIC_Group,0,MUIA_Frame,MUIV_Frame_Group,MUIA_FrameTitle,str8,MUIA_Group_Columns,2,$8FFFFFFF,MUIA_Group_Child
  206.     dc.l    $8FFFFFFF,MUIA_Group_Child,$8FFFFFFF,MUIA_Group_Child,$8FFFFFFF,MUIA_Group_Child,0
  207.  
  208.     dc.l    MUIC_Text,TX_label_0,MUIA_Background,131,MUIA_Text_Contents,STR_TX_label_0,MUIA_Text_SetMax,0,MUIA_Text_SetMin,1
  209.     dc.l    MUIA_Frame,9,0
  210.  
  211.     dc.l    MUIC_Group,0,$8FFFFFFF,MUIA_Group_Child,$8FFFFFFF,MUIA_Group_Child,0
  212.  
  213.     dc.l    MUIC_Window,WI_SpecialChars,MUIA_Window_Title,str7,MUIA_Window_ID,'0WIN',$8FFFFFFF,MUIA_Window_RootObject,0
  214.  
  215.     dc.l    MUIC_Application,App,MUIA_Application_Author,str1,MUIA_Application_Base,str2,MUIA_Application_Title,str3,MUIA_Application_Version,str4
  216.     dc.l    MUIA_Application_Copyright,str5,MUIA_Application_Description,str6,$8FFFFFFF,MUIA_Application_Window,0
  217.  
  218.     dc.l    0
  219.  
  220. App    dc.l    0
  221. WI_SpecialChars    dc.l    0
  222. BT_label_0    dc.l    0
  223. BT_label_1    dc.l    0
  224. BT_label_2    dc.l    0
  225. BT_label_3    dc.l    0
  226. TX_label_0    dc.l    0
  227. STR_TX_label_0    dc.b    '',27,'c',27,'iwith the ''special'' characters',10,'',27,'byou will be able',10,'',27,'8',27,'n',27,'bto do what you want !!!',0
  228.  
  229. catalog_name    dc.b    'RamDisk:Special Chars.catalog',0
  230. str1    dc.b    'Eric Totel',0
  231. str2    dc.b    'SPECCHARS',0
  232. str3    dc.b    'Special Chars',0
  233. str4    dc.b    '$VER: SpecialChars 1.0',0
  234. str5    dc.b    'Eric Totel (c) 1994',0
  235. str6    dc.b    'just a demo !!!',0
  236. str7    dc.b    'Special Chars',0
  237. str8    dc.b    'Buttons',0
  238. str9    dc.b    '',27,'8button_title',0
  239. str10    dc.b    '',27,'8b',27,'0',27,'button_title',0
  240. str11    dc.b    '',27,'i',27,'8b',27,'i',27,'0utton_title',0
  241. str12    dc.b    '',27,'bbutton_title',0
  242.     ENDC    ;GENERATE_DECLS
  243.  
  244. MUIMASTER_BASE    dc.l    0
  245.  
  246.     tags
  247.     library    muimaster,2    ;I want to open muimaster
  248.                 ;library version at least
  249.                 ;two at start.
  250.     finish
  251.